package com.zyw.util;


import javax.xml.ws.Service;
import java.text.SimpleDateFormat;
import java.util.Date;

public class UnitConversionUtil {


    public static String nowDate(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(new Date());
    }

    public static String conversionDate(String date){
        if (!"".equals(date) && null != date) {
            date = date.substring(0, date.lastIndexOf("."));

        }
        return date;
    }

    public static String conversionDateContrary(String date){
        if ("".equals(date) ) {
            return null;
        }
        return date;
    }

    public static  String conversionTrue(String trueFalse){
        if ("0".equals(trueFalse)){
            return "false";
        }
        return "true";
    }
    public static  String conversionTrueContrary(String trueFalse){
        if ("on".equals(trueFalse)){
            return "1";
        }
        return "0";
    }


}
